package com.jdqzyy.noobnoob.video.controller;

import java.util.Arrays;
import java.util.Map;

import com.jdqzyy.noobnoob.common.resultVO.NoobResult;
import com.jdqzyy.noobnoob.common.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jdqzyy.noobnoob.video.entity.RecoveryGroupEntity;
import com.jdqzyy.noobnoob.video.service.RecoveryGroupService;



/**
 * 
 *
 * @author 仲杨阳
 * @email 2462705471@qq.com
 * @date 2020-12-26 22:51:42
 */
@RestController
@RequestMapping("video/recoverygroup")
public class RecoveryGroupController {
    @Autowired
    private RecoveryGroupService recoveryGroupService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("video:recoverygroup:list")
    public NoobResult list(@RequestParam Map<String, Object> params){
        PageUtils page = recoveryGroupService.queryPage(params);

        return NoobResult.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("video:recoverygroup:info")
    public NoobResult info(@PathVariable("id") Integer id){
		RecoveryGroupEntity recoveryGroup = recoveryGroupService.getById(id);

        return NoobResult.ok().put("recoveryGroup", recoveryGroup);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("video:recoverygroup:save")
    public NoobResult save(@RequestBody RecoveryGroupEntity recoveryGroup){
		recoveryGroupService.save(recoveryGroup);

        return NoobResult.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("video:recoverygroup:update")
    public NoobResult update(@RequestBody RecoveryGroupEntity recoveryGroup){
		recoveryGroupService.updateById(recoveryGroup);

        return NoobResult.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("video:recoverygroup:delete")
    public NoobResult delete(@RequestBody Integer[] ids){
		recoveryGroupService.removeByIds(Arrays.asList(ids));

        return NoobResult.ok();
    }

}
